﻿
@{
    ViewData["Title"] = "模板匹配";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<div class="container-div white-bg">
    <div class="ibox-content">
        <form class="form-horizontal m" id="matchForm" autocomplete="off">
            <input type="hidden" id="channelId" name="channelId" value="@(ViewBag.ChannelId)">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">栏目名称：</label>
                <div class="col-sm-8">
                    <input class="form-control" type="text" name="channelname" id="channelname" value="@(ViewBag.ChannelName)" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">栏目模板：</label>
                <div class="col-sm-8">
                    @Html.DropDownList("templateChannelId", ViewBag.ChannelTS as SelectList,new {@class= "form-control" })
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">内容模板：</label>
                <div class="col-sm-8">
                    @Html.DropDownList("templateContentId", ViewBag.ContentTS as SelectList, new { @class = "form-control" })
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="footerbar">
                <div class="col-sm-12 col-sm-offset-4">
                    <button class="btn btn-primary" type="submit">
                        <i class="fa fa-check"></i>
                        保存
                    </button>
                    <button class="btn btn-danger" type="button" onclick="cancel()">
                        <i class="fa fa-reply-all"></i>关闭
                    </button>
                </div>
            </div>
        </form>

    </div>
</div>
@section scripts{
    <script type="text/javascript">
        $(function () {
            $('#matchForm').validator({
                stopOnError: false,
                timely: 2,
                theme: "yellow_right",
                valid: function (form) {
                    //console.log(form);
                    jutils.ajaxPost("/cms/TemplateMatch/SetMatch", $(form).serialize(), function (res) {
                        if (res.status) {
                            cancel();
                        }
                    });
                },
            });
        });
      
        function cancel() {
            jutils.closeDialog();
        }

    </script>
}

